﻿<cfsilent>
	<cfscript>
    
		keyword = event.getArg("Keywords");
		
		rs_teachers = queryNew("tch_id, tch_name, institute_name");

		if ( len(keyword) ) {
			
			condition = keyword & "%";
		
			sql = "SELECT 
						a.tch_id, a.tch_name, 
						b.institute_name 
						FROM t_teacher a 
							INNER JOIN t_institute b ON b.institute_id = a.institute_id 
						WHERE 
							  a.tch_id like :condition 
							  OR 
							  a.tch_name like :condition 
						ORDER BY a.tch_name ASC";
			
			queryObj = new Query( datasource=application.dnsSlave, maxRows=30 );
			
			queryObj.addParam(name="condition", value=condition, cfsqltype="cf_sql_varchar");

			rs_teachers = queryObj.execute(sql=sql).getResult();

		}
		
		event.setArg("pageTitle", "平台管理团队 - 创建用户授权");
		
		targetArgs = structNew();

    </cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('groupUser')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">管理团队</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i>创建用户授权
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	
	<ul class="accountSearch">
		<li>
			<div class="clearfix">
				<form id="formSearch" onSubmit="javascript:return processVerfiyForm('formSearch');" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('createUserAuthorize')#</cfoutput>">
					<div class="label">
						<b>工号或姓名</b>
						<input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
					</div>
					<hr/>
					<div class="lable">
						<input class="button1" type="submit" value="搜索用户" />
					</div>
				</form>
			</div>
		</li>
	</ul>
	
	<cfif rs_teachers.recordCount>

		<ul class="groupUser">
			<li>
				<div class="clearfix">
					<h2>教师</h2>
					<div class="clearfix">
					
						<cfloop query="rs_teachers" >
							<cfset structInsert(targetArgs, "uid", rs_teachers.tch_id, true) />
							<div class="UISmallUserCard">
								<div class="cardContent">
									<a href="<cfoutput>#buildURL('userAuthorizeGroup', targetArgs)#</cfoutput>"><img class="img" src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/graphic/userSmall.png" style="background-image: url('<cfoutput>#getContextRoot()#</cfoutput>/acadmicManager/teacher/portrait/<cfoutput>#rs_teachers.tch_id#</cfoutput>.jpg');"></a>
									<div class="cardDetail">
										<h3><cfoutput><a href="#buildURL('userAuthorizeGroup', targetArgs)#">#rs_teachers.tch_name#</a> <span class="uid">(#rs_teachers.tch_id#)</span></cfoutput></h3>
										<p><cfoutput>#rs_teachers.institute_name#</cfoutput></p>
									</div>
								</div>
							</div>
						</cfloop>
					</div>
				</div>
			</li>
		</ul>

	</cfif>

</div>